package com.hw.servlet;

import com.google.gson.Gson;

import javax.jws.WebService;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

@WebServlet(name = "vue",urlPatterns = "/vue")
public class VueServlet extends javax.servlet.http.HttpServlet {
    protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {

    }

    protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        response.setContentType("application/json;utf-8");
        PrintWriter out=response.getWriter();
        Map<String,Object> json=new HashMap<>();
        json.put("data","xjkl");
        out.write(new Gson().toJson(json));
        System.out.println(new Gson().toJson(json));
    }
}
